network object

This method will disconnect a connected peer as soon as possible, while still giving them a guaranteed notification.

bool disconnect_peer(uint peer_id)

Parameters:
peer_id
The unique ID of the peer to disconnect.

Return value:
true on success, false on failure.

Remarks:
This function will send out a disconnection request immediately, without first taking the time to send any packets that may previously have been queued. This means that the disconnection will happen as soon as possible, while still giving the remote peer a guaranteed notification.

When this function returns, the disconnection is not yet complete. Only when an event of type disconnect that contains the peer ID in question has been received, is the disconnection successful.

Example:
See the main network chapter.